package com.example.demo.JavaFoundation.model;

import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-05-13
 * Time: 17:40
 */
@Data
public class Person2 {
    private int id;
    private int age;
    private String name;

    public Person2(int id, int age, String name) {
        this.id = id;
        this.age = age;
        this.name = name;
    }
}
//实现一个比较器 --> “对外”提供排序的接口。
class PersonComparator implements java.util.Comparator<Person> {

    @Override
    public int compare(Person o1, Person o2) {
        return o1.getAge() - o2.getAge();
    }
}